extends Area2D

var CanEnter = false

# Called when the node enters the scene tree for the first time.
func _ready():
	$Label.visible = false

func _input(event):
	if event.is_action_pressed("X") and CanEnter:
		CommonSignals.emit_signal("SwitchFloor")


func _on_Elevator_body_entered(body):
	if body.name == "Player":
		$Label.visible = true
		CommonSignals.emit_signal("PlayerNearElevator")
		CanEnter = true


func _on_Elevator_body_exited(body):
	if body.name == "Player":
		$Label.visible = false
		CommonSignals.emit_signal("PlayerLeaveElevator")
		CanEnter = false
